#define _CRT_SECURE_NO_WARNINGS 1

class Solution {
public:
    int n = 0;
    int k = 0;
    vector<vector<int>> ret;
    vector<int> path;
    vector<vector<int>> combine(int _n, int _k) {
        n = _n;
        k = _k;
        dfs(1);
        return ret;
    }

    void dfs(int i)
    {
        if (k == 0)
        {
            ret.push_back(path);
            return;
        }

        for (; i <= n; ++i)
        {
            path.push_back(i);
            k--;
            dfs(i + 1);
            path.pop_back();
            k++;
        }
    }
};